Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix misuse of CMAKE_SIZEOF_VOID_P in testing #79095

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kntkymt
Copy link
Contributor

@kntkymt kntkymt commented Feb 1, 2025

Motivation

There are a few instances of misuse of CMAKE_SIZEOF_VOID_P in test files. This flag is intended to represent the byte size of a word, but we mistakenly pass %target-ptrsize (which is bits size of a word) to it.

Fortunately, it does not seem to affect the test results. However, we should fix this to prevent similar mistakes in the future.

Solution

Use WORD_BITS instead.

Alternative Considered

-DCMAKE_SIZEOF_VOID_P=$((%target-ptrsize/8)) works too but it seems we used the value to making bits representation of word (it's redundant), it would be better to use WORD_BITS in these situation (especially in testing files).

word_bits = int(CMAKE_SIZEOF_VOID_P) * 8

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[note for reviewers] Since it seems we didn't use the flag in this file, let me remove it instead of fixing the flag.

@kntkymt kntkymt marked this pull request as ready for review February 1, 2025 15:19
@kntkymt kntkymt requested a review from a team as a code owner February 1, 2025 15:19
@kntkymt kntkymt changed the title Fix misuse of CMAKE_SIZEOF_VOID in testing Fix misuse of CMAKE_SIZEOF_VOID_P in testing Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant